﻿using System;

namespace YArchitech.MEP
{
	public static class Hydrokinetics
	{
		public static double BhDqYl(double temperature)
		{
			if (temperature < -40.0 || temperature > 60.0)
			{
				return -1.0;
			}
			int num = (int)temperature;
			int num2 = num + 1;
			double num3 = Hydrokinetics.BaoHeYaLi[num + 40];
			double num4 = Hydrokinetics.BaoHeYaLi[num2 + 40];
			return num3 + (num4 - num3) * (temperature - (double)num);
		}

		public static double AtmosphericDensity(double temperature, double relativeHumidity, double atmosphericPressure)
		{
			double result;
			if (temperature < -40.0 || temperature > 60.0)
			{
				result = 352.0 / (temperature + 273.15);
			}
			else
			{
				result = 0.003484 * atmosphericPressure / (temperature + 273.15) - 0.00134 * relativeHumidity * Hydrokinetics.BhDqYl(temperature) / (temperature + 273.15);
			}
			return result;
		}

		public static double DynamicPressure(double velocity, double density)
		{
			return velocity * velocity * density / 2.0;
		}

		public static double CalWaterFlow(double load, double temperatureDifference)
		{
			return Math.Abs(load / 1.163 / temperatureDifference) / 3600.0;
		}

		public static double Rs(double A, double X)
		{
			return A / X;
		}

		public static double Rs_Rectangular(double w, double h)
		{
			return Hydrokinetics.Rs(HYMathUtility.Area_Rectangular(w, h), HYMathUtility.Circumference_Rectangular(w, h));
		}

		public static double Rs_Round(double dia)
		{
			return Hydrokinetics.Rs(HYMathUtility.Area_Round(dia), HYMathUtility.Circumference_Round(dia));
		}

		public static double Re(double D, double V, double v)
		{
			return D * V / v;
		}

		public static double D(double Rs)
		{
			return 4.0 * Rs;
		}

		public static double D_Rectangular(double w, double h)
		{
			return 2.0 * w * h / (w + h);
		}

		public static double D_F(double w, double h)
		{
			return 1.297 * Math.Pow(Math.Pow(w * h, 3.112) / Math.Pow(w + h, 1.217), 0.19972039145196727);
		}

		public static double D_A(double w, double h)
		{
			return 2.0 * Math.Pow(w * h / Math.PI, 0.5);
		}

		public static double VFlow(double area, double velocity)
		{
			return area * velocity;
		}

		public static double VFlow_Rectangular(double w, double h, double velocity)
		{
			return Hydrokinetics.VFlow(HYMathUtility.Area_Rectangular(w, h), velocity);
		}

		public static double L_Circle(double diameter, double velocity)
		{
			return Hydrokinetics.VFlow(HYMathUtility.Area_Round(diameter), velocity);
		}

		public static double Velocity(double vFlow, double area)
		{
			if (HYMathUtility.IsZero(area, 0.001))
			{
				return 0.0;
			}
			return vFlow / area;
		}

		public static double Velocity_Rectangular(double vFlow, double w, double h)
		{
			return Hydrokinetics.Velocity(vFlow, HYMathUtility.Area_Rectangular(w, h));
		}

		public static double Velocity_Round(double vFlow, double diameter)
		{
			return Hydrokinetics.Velocity(vFlow, HYMathUtility.Area_Round(diameter));
		}

		public static double x_LF(double Re)
		{
			return 64.0 / Re;
		}

		public static double x_TF_B(double Re)
		{
			return 0.3164 / Math.Pow(Re, 0.25);
		}

		public static double x_TF_PN(double Re)
		{
			double b = 1.0;
			double num = Math.Pow(2.71828, 0.8) / Math.Pow(Re, 2.0);
			double num2 = 1.0;
			double num3 = (num + num2) / 2.0;
			double num4 = 2.0 * Math.Log10(Re * Math.Pow(num3, 0.5)) - 0.8 - 1.0 / Math.Pow(num3, 0.5);
			while (!HYMathUtility.IsEqual(num4, 0.0, 1E-09))
			{
				if (num4 > 0.0)
				{
					num2 = num3;
				}
				else
				{
					num = num3;
				}
				num3 = (num + num2) / 2.0;
				num4 = 2.0 * Math.Log10(Re * Math.Pow(num3, 0.5)) - 0.8 - 1.0 / Math.Pow(num3, 0.5);
				if (HYMathUtility.IsEqual(num3, b, 1E-09))
				{
					break;
				}
				b = num3;
			}
			return num3;
		}

		public static double x_TF_CW(double Re, double KD)
		{
			double b = 1.0;
			double num = 0.0;
			double num2 = 1.0;
			double num3 = (num + num2) / 2.0;
			double num4 = 1.0 / Math.Pow(num3, 0.5) + 2.0 * Math.Log10(KD / 3.7 + 2.51 / (Re * Math.Pow(num3, 0.5)));
			while (!HYMathUtility.IsEqual(num4, 0.0, 1E-09))
			{
				if (num4 > 0.0)
				{
					num = num3;
				}
				else
				{
					num2 = num3;
				}
				num3 = (num + num2) / 2.0;
				num4 = 1.0 / Math.Pow(num3, 0.5) + 2.0 * Math.Log10(KD / 3.7 + 2.51 / (Re * Math.Pow(num3, 0.5)));
				if (HYMathUtility.IsEqual(num3, b, 1E-09))
				{
					break;
				}
				b = num3;
			}
			return num3;
		}

		public static double x_TF_SJ(double Re, double KD)
		{
			return 1.352 / Math.Pow(Math.Log(KD / 3.7 + 5.74 / Math.Pow(Re, 0.9)), 2.0);
		}

		public static double x_TF_A(double Re, double KD)
		{
			return 0.11 * Math.Pow(KD + 68.0 / Re, 0.25);
		}

		public static double x_TF_M(double Re, double KD)
		{
			return 0.005 * (1.0 + Math.Pow(20000.0 * KD + 1000000.0 / Re, 0.33333333333333331));
		}

		public static double x_TF_KN(double KD)
		{
			return 1.0 / Math.Pow(2.0 * Math.Log10(1.0 / KD) + 1.14, 2.0);
		}

		public static double x_TF_X(double KD)
		{
			return 0.11 * Math.Pow(KD, 0.25);
		}

		public static double Pd(double e, double V, double Rou)
		{
			return e * V * V * Rou / 2.0;
		}

		public static double hd(double e, double V, double g = 9.81)
		{
			return e * V * V / 2.0 / g;
		}

		public static double Pl(double l, double x, double Rs, double V, double Rou)
		{
			return x * V * V * Rou * l / 8.0 / Rs;
		}

		public static double Rm(double x, double Rs, double V, double Rou)
		{
			return Hydrokinetics.Pl(1.0, x, Rs, V, Rou);
		}

		public static double Pl_Round(double l, double x, double D, double V, double Rou)
		{
			return Hydrokinetics.Pl(l, x, D / 4.0, V, Rou);
		}

		public static double Rm_Round(double x, double D, double V, double Rou)
		{
			return Hydrokinetics.Pl_Round(1.0, x, D, V, Rou);
		}

		public static double Pl_Rectangular(double l, double x, double a, double b, double V, double Rou)
		{
			double rs = a * b / (a + b) / 2.0;
			return Hydrokinetics.Pl(l, x, rs, V, Rou);
		}

		public static double Rm_Rectangular(double x, double a, double b, double V, double Rou)
		{
			return Hydrokinetics.Pl_Rectangular(1.0, x, a, b, V, Rou);
		}

		public static double EquivalentLength(double length, double e, double D, double x)
		{
			return length + e * D / x;
		}

		public static double Lambda(double Re, double KD)
		{
			if (HYMathUtility.IsZero(Re, 0.001))
			{
				return 0.0;
			}
			if (Re < 2300.0)
			{
				return Hydrokinetics.x_LF(Re);
			}
			if (Re <= 4000.0)
			{
				return 0.0025 * Math.Pow(Re, 0.33333333333333331);
			}
			double num = Hydrokinetics.x_TF_CW(Re, KD);
			if (Re > 191.2 / Math.Sqrt(num) / KD)
			{
				return Hydrokinetics.x_TF_X(KD);
			}
			if (Re < 26.98 * Math.Pow(1.0 / KD, 1.1428571428571428))
			{
				return Hydrokinetics.x_TF_B(Re);
			}
			return num;
		}

		public static double PPR_i(double d, double G, bool bCold)
		{
			return (bCold ? 0.0112 : 0.0089) * Math.Pow(d, -4.87) * Math.Pow(G, 1.85) * 1000.0;
		}

		public static double PPR_Diameter(double i, double G, bool bCold)
		{
			return Math.Pow((bCold ? 11.2 : 8.9) * Math.Pow(G, 1.85) / i, -0.20533880903490759);
		}

		public static double PPR_K1(int nTemperature)
		{
			int num = Hydrokinetics.aryTforK1.Length;
			if (num != Hydrokinetics.aryK1.Length)
			{
				throw new Exception("TforK1 and K1 must same length");
			}
			int i;
			for (i = 0; i < num; i++)
			{
				if (nTemperature == Hydrokinetics.aryTforK1[i])
				{
					return Hydrokinetics.aryK1[i];
				}
				if (Hydrokinetics.aryTforK1[i] > nTemperature)
				{
					break;
				}
			}
			if (i == 0)
			{
				return Hydrokinetics.aryK1[i];
			}
			if (i == num)
			{
				return Hydrokinetics.aryK1[i - 1];
			}
			double result = Hydrokinetics.aryK1[i];
			double result2 = Hydrokinetics.aryK1[i - 1];
			int num2 = Hydrokinetics.aryTforK1[i];
			int num3 = Hydrokinetics.aryTforK1[i - 1];
			int num4 = nTemperature - num3;
			int num5 = num2 - nTemperature;
			if (num4 <= num5)
			{
				return result2;
			}
			return result;
		}

		public static double PPR_K2(int pipingType = 0)
		{
			return Hydrokinetics.aryK2[pipingType];
		}

		public static double PPR_ii(double ii, double k1, double k2)
		{
			return ii * k1;
		}

		public static double Plastic_b(double Res, double Rez)
		{
			return 1.0 + Math.Log10(Res) / Math.Log10(Rez);
		}

		public static double Plastic_Rez(double dn, double kd)
		{
			return 500.0 * dn / kd;
		}

		public static double Plastic_Res(double dn, double dVelocity, double dViscosity)
		{
			return dn * dVelocity / dViscosity;
		}

		public static double Plastic_dn(double dw, double delt_dw, double thick, double delt_thick)
		{
			return 0.5 * (2.0 * dw + delt_dw - 4.0 * thick - 2.0 * delt_thick);
		}

		public static double GetPlastic_lmd(double b, double dn, double kd, double Res)
		{
			if (HYMathUtility.IsZero(Res, 0.001))
			{
				return 0.0;
			}
			if (Res < 2300.0)
			{
				return 64.0 / Res;
			}
			double num = Math.Log10(3.7 * dn / kd);
			double num2 = b / 2.0 + 1.312 * (2.0 - b) * num / (Math.Log10(Res) - 1.0);
			return Math.Pow(0.5 * num2 / num, 2.0);
		}

		public static double Steam_Rm(double Gt, double d, double den, double K)
		{
			return 0.00688 * Math.Pow(K, 0.25) * (Math.Pow(Gt, 2.0) / (den * Math.Pow(d, 5.25)));
		}

		public static double Steam_d(double Gt, double R, double den, double K)
		{
			return 0.387 * (Math.Pow(K, 0.0476) * Math.Pow(Gt, 0.381) / Math.Pow(den * R, 0.19));
		}

		public static double Steam_Gt(double R, double d, double den, double K)
		{
			return 12.06 * (Math.Pow(den * R, 0.5) * Math.Pow(d, 2.625) / Math.Pow(K, 0.125));
		}

		public static double SyphonCLR_Rectangle(double dKG)
		{
			double num = 0.0;
			if (dKG > 6.0)
			{
				num = 0.21;
			}
			else if (dKG > 3.0)
			{
				num = (double)((int)(0.5 + 100.0 * (0.01 * Math.Pow(dKG, 1.0) + 0.15))) / 100.0;
			}
			else if (dKG > 0.25)
			{
				num = (double)((int)(0.5 + 100.0 * (0.0034 * Math.Pow(dKG, 3.0) + 0.015 * Math.Pow(dKG, 2.0) - 0.101 * Math.Pow(dKG, 1.0) + 0.295))) / 100.0;
			}
			if (num <= 0.0)
			{
				return 0.0;
			}
			return num;
		}

		public static double SyphonCLR_Rectangle(double dAngle, double dGK, double dRW)
		{
			double num = HYMathUtility.RToD(dAngle);
			int num2 = Hydrokinetics.SyphonXZ.Length / 2;
			int num3 = 0;
			while (num3 < num2 && Hydrokinetics.SyphonXZ[num3, 0] <= num)
			{
				num3++;
			}
			double num4;
			if (num3 == num2)
			{
				num4 = Hydrokinetics.SyphonXZ[num2 - 1, 1];
			}
			else if (num3 == 0)
			{
				num4 = Hydrokinetics.SyphonXZ[0, 1];
			}
			else
			{
				num4 = Hydrokinetics.SyphonXZ[num3 - 1, 1] + (Hydrokinetics.SyphonXZ[num3, 1] - Hydrokinetics.SyphonXZ[num3 - 1, 1]) * (num - Hydrokinetics.SyphonXZ[num3 - 1, 0]) / (Hydrokinetics.SyphonXZ[num3, 0] - Hydrokinetics.SyphonXZ[num3 - 1, 0]);
			}
			double num5;
			if (dRW < 1.001)
			{
				if (dGK < 2.001)
				{
					num5 = (0.1549 * Math.Pow(dGK, 2.0) - 0.6479 * dGK + 1.6781) * (0.1784 * Math.Pow(dRW, -2.4979));
				}
				else
				{
					num5 = (0.0002 * Math.Pow(dGK, 3.0) - 0.0109 * Math.Pow(dGK, 2.0) + 0.1322 * dGK + 0.6944) * (0.1805 * Math.Pow(dRW, -2.4809));
				}
			}
			else if (dGK < 2.001)
			{
				num5 = 0.151 * Math.Pow(dGK, -0.2061) * (1.3943 * Math.Pow(dRW, -0.4878));
			}
			else
			{
				num5 = (0.005 * dGK + 0.1151) * (1.4229 * Math.Pow(dRW, -0.5169));
			}
			num5 *= num4;
			if (num5 <= 0.0)
			{
				return 0.0;
			}
			return num5;
		}

		public static double SyphonDragLocalIndexRound(double dangle, double dR_D)
		{
			double num = HYMathUtility.RToD(dangle);
			int length = Hydrokinetics.SyphonLocalIndex.GetLength(0);
			int num2 = 0;
			while (num2 < length && Hydrokinetics.SyphonLocalIndex[num2, 0] <= dR_D)
			{
				num2++;
			}
			double num3;
			if (num2 == length)
			{
				num3 = Hydrokinetics.SyphonLocalIndex[length - 1, 1];
			}
			else if (num2 == 0)
			{
				num3 = Hydrokinetics.SyphonLocalIndex[0, 1];
			}
			else
			{
				num3 = Hydrokinetics.SyphonLocalIndex[num2 - 1, 1] + (Hydrokinetics.SyphonLocalIndex[num2, 1] - Hydrokinetics.SyphonLocalIndex[num2 - 1, 1]) * (dR_D - Hydrokinetics.SyphonLocalIndex[num2 - 1, 0]) / (Hydrokinetics.SyphonLocalIndex[num2, 0] - Hydrokinetics.SyphonLocalIndex[num2 - 1, 0]);
			}
			length = Hydrokinetics.SyphonXZ.GetLength(0);
			num2 = 0;
			while (num2 < length && Hydrokinetics.SyphonXZ[num2, 0] <= num)
			{
				num2++;
			}
			if (num2 == length)
			{
				num3 *= Hydrokinetics.SyphonXZ[length - 1, 1];
			}
			else if (num2 == 0)
			{
				num3 *= Hydrokinetics.SyphonXZ[0, 1];
			}
			else
			{
				num3 *= Hydrokinetics.SyphonXZ[num2 - 1, 1] + (Hydrokinetics.SyphonXZ[num2, 1] - Hydrokinetics.SyphonXZ[num2 - 1, 1]) * (num - Hydrokinetics.SyphonXZ[num2 - 1, 0]) / (Hydrokinetics.SyphonXZ[num2, 0] - Hydrokinetics.SyphonXZ[num2 - 1, 0]);
			}
			return num3;
		}

		public static double SyphonDragLocalIndexRectangular(double dangle, double dR_B, double dRe, double dWidth, double dHigh)
		{
			double num = 1.0;
			if (dWidth / dHigh >= 0.25 && dWidth / dHigh <= 3.0 && dR_B >= 0.5 && dR_B <= 2.0)
			{
				if (dR_B >= 1.0)
				{
					num = 0.1 * Math.Pow(dWidth / dHigh, 0.15) * (Math.Pow(1.0 / dR_B, 3.3) + 1.4);
				}
				else
				{
					num = 0.1 * Math.Pow(dWidth / dHigh, 0.15) * (Math.Pow(1.0 / dR_B, 3.3) + 1.4) * (1.0 - 0.12 * dR_B);
				}
			}
			dRe /= 10000.0;
			double num3;
			if (dR_B < 0.75)
			{
				int num2 = 0;
				while (num2 < 9 && Hydrokinetics.SyphonXZRe[0, num2, 1] <= dRe)
				{
					num2++;
				}
				if (num2 == 9)
				{
					num3 = Hydrokinetics.SyphonXZRe[0, 8, 2];
				}
				else if (num2 == 0)
				{
					num3 = Hydrokinetics.SyphonXZRe[0, 0, 2];
				}
				else
				{
					num3 = Hydrokinetics.SyphonXZRe[0, num2 - 1, 2] + (Hydrokinetics.SyphonXZRe[0, num2, 2] - Hydrokinetics.SyphonXZRe[0, num2 - 1, 2]) * (dRe - Hydrokinetics.SyphonXZRe[0, num2 - 1, 1]) / (Hydrokinetics.SyphonXZRe[0, num2, 1] - Hydrokinetics.SyphonXZRe[0, num2 - 1, 1]);
				}
			}
			else
			{
				int num4 = 0;
				while (num4 < 9 && Hydrokinetics.SyphonXZRe[1, num4, 1] <= dRe)
				{
					num4++;
				}
				if (num4 == 9)
				{
					num3 = Hydrokinetics.SyphonXZRe[1, 8, 2];
				}
				else if (num4 == 0)
				{
					num3 = Hydrokinetics.SyphonXZRe[1, 0, 2];
				}
				else
				{
					num3 = Hydrokinetics.SyphonXZRe[1, num4 - 1, 2] + (Hydrokinetics.SyphonXZRe[1, num4, 2] - Hydrokinetics.SyphonXZRe[1, num4 - 1, 2]) * (dRe - Hydrokinetics.SyphonXZRe[1, num4 - 1, 1]) / (Hydrokinetics.SyphonXZRe[1, num4, 1] - Hydrokinetics.SyphonXZRe[1, num4 - 1, 1]);
				}
			}
			dangle = HYMathUtility.RToD(dangle);
			int num5 = 0;
			while (num5 < 11 && Hydrokinetics.SyphonXZ[num5, 0] < dangle)
			{
				num5++;
			}
			double num6;
			if (num5 == 11)
			{
				num6 = Hydrokinetics.SyphonXZ[num5 - 1, 1];
			}
			else if (num5 == 0)
			{
				num6 = Hydrokinetics.SyphonXZ[0, 1];
			}
			else
			{
				num6 = Hydrokinetics.SyphonXZ[num5 - 1, 1] + (Hydrokinetics.SyphonXZ[num5, 1] - Hydrokinetics.SyphonXZ[num5 - 1, 1]) * (dangle - Hydrokinetics.SyphonXZ[num5 - 1, 0]) / (Hydrokinetics.SyphonXZ[num5, 0] - Hydrokinetics.SyphonXZ[num5 - 1, 0]);
			}
			return num * num3 * num6;
		}

		public static double HeLiuSanTongDragLocalIndex(double V1, double L1, double V2, double L2, double V3, double L3, double a2, double a3, bool ba2)
		{
			double num = L2 / L1 * V2 * Math.Cos(a2) + L3 / L1 * V3 * Math.Cos(a3);
			if (num > V1 && !ba2)
			{
				return Math.Pow(V3 / V1, 2.0) - 2.0 * num / V1 + 1.0;
			}
			if (num > V1 && ba2)
			{
				return Math.Pow(V2 / V1, 2.0) - 2.0 * num / V1 + 1.0;
			}
			if (num <= V1 && !ba2)
			{
				return Math.Pow(V3 / V1, 2.0) - 0.5 * Math.Pow(num / V1, 2.0) - num / V1 + 0.5;
			}
			if (num <= V1 && ba2)
			{
				return Math.Pow(V2 / V1, 2.0) - 0.5 * Math.Pow(num / V1, 2.0) - num / V1 + 0.5;
			}
			return 0.0;
		}

		public static double FenLiuSanTongDragLocalIndex(double V1, double L1, double V2, double L2, double a2, bool bPangTong = true, bool bRound = true)
		{
			if (bPangTong && bRound)
			{
				double num = L2 * L1 / V1 / L1 / (L2 / V2);
				if (HYMathUtility.IsEqual(HYMathUtility.RToD(a2), 45.0, 0.1))
				{
					return (0.4 + Math.Pow(num - 0.81, 2.0)) / num / num;
				}
				if (HYMathUtility.IsEqual(HYMathUtility.RToD(a2), 90.0, 0.1))
				{
					return 0.5 + 1.0 / num / num;
				}
				if (Math.Cos(a2) > num)
				{
					return (Math.Pow(Math.Sin(a2), 2.0) + Math.Pow(Math.Cos(a2) - num, 2.0)) / num;
				}
				return (Math.Pow(Math.Sin(a2), 2.0) + 0.5 * num * (num - Math.Cos(a2))) / num / num;
			}
			else
			{
				if (!bPangTong && bRound)
				{
					return 0.35 * Math.Pow(L1 * (L2 / V2) / L2 / (L1 / V1) - 1.0, 2.0);
				}
				if (bPangTong && !bRound)
				{
					if (V2 / V1 >= 0.5 && V2 / V1 <= 2.0)
					{
						return 0.35 * Math.Pow(V2 / V1, 2.0) + 0.7;
					}
					return 0.0;
				}
				else
				{
					if (bPangTong || bRound)
					{
						return 0.0;
					}
					if (V2 / V1 >= 0.0 && V2 / V1 <= 1.0)
					{
						return 0.35 * Math.Pow(1.0 - V2 / V1, 2.0);
					}
					return 0.0;
				}
			}
		}

		public static double DistributaryCLR_45Circle_S(double dQc, double dAc, double dQs, double dAs)
		{
			double num = dQc / dAc;
			double num2 = dQs / dAs / num;
			double num3;
			if (1.999 < num2)
			{
				num3 = 0.72 * num2 - 1.28;
			}
			else if (0.779 < num2)
			{
				num3 = 0.15;
			}
			else if (0.499 < num2)
			{
				num3 = 0.4304 * Math.Pow(num2, 2.0) - 0.8171 * num2 + 0.5059;
			}
			else if (0.199 < num2)
			{
				num3 = 3237.9 * Math.Pow(num2, 4.0) - 4893.2 * Math.Pow(num2, 3.0) + 2815.7 * Math.Pow(num2, 2.0) - 737.25 * num2 + 75.038;
			}
			else
			{
				num3 = 0.0842 * Math.Pow(num2, -2.7678);
			}
			if (num3 <= 0.0)
			{
				return 0.0;
			}
			return num3;
		}

		public static double DistributaryCLR_90Circle_S(double dQc, double dAc, double dQs, double dAs)
		{
			double num = dQc / dAc;
			double num2 = dQs / dAs / num;
			double num3;
			if (1.999 < num2)
			{
				num3 = 0.72 * num2 - 1.28;
			}
			else if (0.779 < num2)
			{
				num3 = 0.15;
			}
			else if (0.499 < num2)
			{
				num3 = 0.4304 * Math.Pow(num2, 2.0) - 0.8171 * num2 + 0.5059;
			}
			else if (0.199 < num2)
			{
				num3 = 3237.9 * Math.Pow(num2, 4.0) - 4893.2 * Math.Pow(num2, 3.0) + 2815.7 * Math.Pow(num2, 2.0) - 737.25 * num2 + 75.038;
			}
			else
			{
				num3 = 0.0842 * Math.Pow(num2, -2.7678);
			}
			if (num3 <= 0.0)
			{
				return 0.0;
			}
			return num3;
		}

		public static double SyphonDragLocalIndexCircle(double dangle, double dR_D)
		{
			double num = HYMathUtility.RToD(dangle);
			int num2 = Hydrokinetics.SyphonLocalIndex.Length / 2;
			int num3 = 0;
			while (num3 < num2 && Hydrokinetics.SyphonLocalIndex[num3, 0] <= dR_D)
			{
				num3++;
			}
			double num4;
			if (num3 == num2)
			{
				num4 = Hydrokinetics.SyphonLocalIndex[num2 - 1, 1];
			}
			else if (num3 == 0)
			{
				num4 = Hydrokinetics.SyphonLocalIndex[0, 1];
			}
			else
			{
				num4 = Hydrokinetics.SyphonLocalIndex[num3 - 1, 1] + (Hydrokinetics.SyphonLocalIndex[num3, 1] - Hydrokinetics.SyphonLocalIndex[num3 - 1, 1]) * (dR_D - Hydrokinetics.SyphonLocalIndex[num3 - 1, 0]) / (Hydrokinetics.SyphonLocalIndex[num3, 0] - Hydrokinetics.SyphonLocalIndex[num3 - 1, 0]);
			}
			num2 = Hydrokinetics.SyphonXZ.Length / 2;
			num3 = 0;
			while (num3 < num2 && Hydrokinetics.SyphonXZ[num3, 0] <= num)
			{
				num3++;
			}
			if (num3 == num2)
			{
				num4 *= Hydrokinetics.SyphonXZ[num2 - 1, 1];
			}
			else if (num3 == 0)
			{
				num4 *= Hydrokinetics.SyphonXZ[0, 1];
			}
			else
			{
				num4 *= Hydrokinetics.SyphonXZ[num3 - 1, 1] + (Hydrokinetics.SyphonXZ[num3, 1] - Hydrokinetics.SyphonXZ[num3 - 1, 1]) * (num - Hydrokinetics.SyphonXZ[num3 - 1, 0]) / (Hydrokinetics.SyphonXZ[num3, 0] - Hydrokinetics.SyphonXZ[num3 - 1, 0]);
			}
			return num4;
		}

		public static double SyphonDragLocalIndexSquare(double dangle, double dR_B, double dRe, double dWidth, double dHigh)
		{
			double num = 1.0;
			if (dWidth / dHigh >= 0.25 && dWidth / dHigh <= 3.0 && dR_B >= 0.5 && dR_B <= 2.0)
			{
				if (dR_B >= 1.0)
				{
					num = 0.1 * Math.Pow(dWidth / dHigh, 0.15) * (Math.Pow(1.0 / dR_B, 3.3) + 1.4);
				}
				else
				{
					num = 0.1 * Math.Pow(dWidth / dHigh, 0.15) * (Math.Pow(1.0 / dR_B, 3.3) + 1.4) * (1.0 - 0.12 * dR_B);
				}
			}
			dRe /= 10000.0;
			double num3;
			if (dR_B < 0.75)
			{
				int num2 = 0;
				while (num2 < 9 && Hydrokinetics.SyphonXZRe[0, num2, 1] <= dRe)
				{
					num2++;
				}
				if (num2 == 9)
				{
					num3 = Hydrokinetics.SyphonXZRe[0, 8, 2];
				}
				else if (num2 == 0)
				{
					num3 = Hydrokinetics.SyphonXZRe[0, 0, 2];
				}
				else
				{
					num3 = Hydrokinetics.SyphonXZRe[0, num2 - 1, 2] + (Hydrokinetics.SyphonXZRe[0, num2, 2] - Hydrokinetics.SyphonXZRe[0, num2 - 1, 2]) * (dRe - Hydrokinetics.SyphonXZRe[0, num2 - 1, 1]) / (Hydrokinetics.SyphonXZRe[0, num2, 1] - Hydrokinetics.SyphonXZRe[0, num2 - 1, 1]);
				}
			}
			else
			{
				int num4 = 0;
				while (num4 < 9 && Hydrokinetics.SyphonXZRe[1, num4, 1] <= dRe)
				{
					num4++;
				}
				if (num4 == 9)
				{
					num3 = Hydrokinetics.SyphonXZRe[1, 8, 2];
				}
				else if (num4 == 0)
				{
					num3 = Hydrokinetics.SyphonXZRe[1, 0, 2];
				}
				else
				{
					num3 = Hydrokinetics.SyphonXZRe[1, num4 - 1, 2] + (Hydrokinetics.SyphonXZRe[1, num4, 2] - Hydrokinetics.SyphonXZRe[1, num4 - 1, 2]) * (dRe - Hydrokinetics.SyphonXZRe[1, num4 - 1, 1]) / (Hydrokinetics.SyphonXZRe[1, num4, 1] - Hydrokinetics.SyphonXZRe[1, num4 - 1, 1]);
				}
			}
			dangle = HYMathUtility.RToD(dangle);
			int num5 = 0;
			while (num5 < 11 && Hydrokinetics.SyphonXZ[num5, 0] < dangle)
			{
				num5++;
			}
			double num6;
			if (num5 == 11)
			{
				num6 = Hydrokinetics.SyphonXZ[num5 - 1, 1];
			}
			else if (num5 == 0)
			{
				num6 = Hydrokinetics.SyphonXZ[0, 1];
			}
			else
			{
				num6 = Hydrokinetics.SyphonXZ[num5 - 1, 1] + (Hydrokinetics.SyphonXZ[num5, 1] - Hydrokinetics.SyphonXZ[num5 - 1, 1]) * (dangle - Hydrokinetics.SyphonXZ[num5 - 1, 0]) / (Hydrokinetics.SyphonXZ[num5, 0] - Hydrokinetics.SyphonXZ[num5 - 1, 0]);
			}
			return num * num3 * num6;
		}

		public static double DistributaryCLR_90Circle_B(double dQc, double dAc, double dQb, double dAb)
		{
			double num = dQc / dAc;
			double num2 = dQb / dAb / num;
			double num3;
			if (1.669 < num2)
			{
				num3 = -0.1246 * num2 + 0.4907;
			}
			else if (1.129 < num2)
			{
				num3 = 0.6139 * Math.Pow(num2, -1.5137);
			}
			else if (0.669 < num2)
			{
				num3 = 0.6455 * Math.Pow(num2, -2.1635);
			}
			else if (0.429 < num2)
			{
				num3 = 0.6273 * Math.Pow(num2, -2.2474);
			}
			else if (0.219 < num2)
			{
				num3 = 0.6709 * Math.Pow(num2, -2.178);
			}
			else
			{
				num3 = 0.741 * Math.Pow(num2, -2.1119);
			}
			if (num3 <= 0.0)
			{
				return 0.0;
			}
			return num3;
		}

		public static double DistributaryCLR_90Circle_B(double dQc, double dAc, double dQb, double dAb, double dQs, double dAs)
		{
			double num = dQc / dAc;
			double num2 = dQb / dAb / num;
			double num3 = dAs / dAc;
			double num4;
			if (num3 < 0.35)
			{
				if (4.999 < num2)
				{
					num4 = 4.537 * Math.Pow(num2, -0.8876);
				}
				else if (2.669 < num2)
				{
					num4 = -0.0135 * Math.Pow(num2, 3.0) + 0.2101 * Math.Pow(num2, 2.0) - 1.2906 * num2 + 3.9645;
				}
				else if (1.399 < num2)
				{
					num4 = 0.2269 * Math.Pow(num2, 3.0) - 1.4074 * Math.Pow(num2, 2.0) + 2.3768 * num2 + 1.1422;
				}
				else if (0.889 < num2)
				{
					num4 = -6.48 * Math.Pow(num2, 2.0) + 15.21 * num2 - 6.66;
				}
				else
				{
					num4 = 37.848 * Math.Pow(num2, 3.0) - 110.01 * Math.Pow(num2, 2.0) + 109.92 * num2 - 35.633;
				}
			}
			else if (num3 < 0.55)
			{
				if (4.999 < num2)
				{
					num4 = 8.1812 * Math.Pow(num2, -0.7816);
				}
				else if (2.669 < num2)
				{
					num4 = -0.4077 * num2 + 4.3244;
				}
				else if (1.399 < num2)
				{
					num4 = -1.2137 * Math.Pow(num2, 4.0) + 11.124 * Math.Pow(num2, 3.0) - 38.874 * Math.Pow(num2, 2.0) + 61.335 * num2 - 33.497;
				}
				else
				{
					num4 = 18.677 * Math.Pow(num2, 3.0) - 82.892 * Math.Pow(num2, 2.0) + 127.49 * num2 - 65.2;
				}
			}
			else if (num3 < 0.8)
			{
				if (4.999 < num2)
				{
					num4 = 4.1303 * Math.Pow(num2, -0.7636);
				}
				else if (2.999 < num2)
				{
					num4 = -0.186 * num2 + 2.12;
				}
				else
				{
					num4 = 0.4942 * Math.Pow(num2, 5.0) - 5.6609 * Math.Pow(num2, 4.0) + 26.224 * Math.Pow(num2, 3.0) - 61.864 * Math.Pow(num2, 2.0) + 74.883 * num2 - 35.841;
				}
			}
			else if (1.669 < num2)
			{
				num4 = -0.1246 * num2 + 0.4907;
			}
			else if (1.129 < num2)
			{
				num4 = 0.6139 * Math.Pow(num2, -1.5137);
			}
			else if (0.669 < num2)
			{
				num4 = 0.6455 * Math.Pow(num2, -2.1635);
			}
			else if (0.429 < num2)
			{
				num4 = 0.6273 * Math.Pow(num2, -2.2474);
			}
			else if (0.219 < num2)
			{
				num4 = 0.6709 * Math.Pow(num2, -2.178);
			}
			else
			{
				num4 = 0.741 * Math.Pow(num2, -2.1119);
			}
			if (num4 <= 0.0)
			{
				return 0.0;
			}
			return num4;
		}

		public static double DistributaryCLR_90Rectangle_S(double dQc, double dAc, double dQs, double dAs)
		{
			double num = dQc / dAc;
			double num2 = dQs / dAs;
			double num3 = 0.0;
			double num4 = num2 / num;
			if (0.571 < num4)
			{
				num3 = (double)((int)(0.5 + 100.0 * (28.814 * Math.Pow(num4, 5.0) - 98.867 * Math.Pow(num4, 4.0) + 123.81 * Math.Pow(num4, 3.0) - 62.266 * Math.Pow(num4, 2.0) + 4.5304 * Math.Pow(num4, 1.0) + 4.0185))) / 100.0;
			}
			else if (0.2 < num4)
			{
				num3 = (double)((int)(0.5 + 100.0 * (-6646.0 * Math.Pow(num4, 5.0) + 14604.0 * Math.Pow(num4, 4.0) - 12869.0 * Math.Pow(num4, 3.0) + 5740.0 * Math.Pow(num4, 2.0) - 1319.1 * Math.Pow(num4, 1.0) + 129.08))) / 100.0;
			}
			else if (0.11 < num4)
			{
				num3 = (double)((int)(0.5 + 32.440000000000005 * Math.Pow(num4, -2.3083))) / 100.0;
			}
			if (num3 <= 0.0)
			{
				return 0.0;
			}
			return num3;
		}

		public static double SideKkPipeCLR_S(double dL0, double dL1)
		{
			return 0.35 * Math.Pow(dL0 / dL1, 2.0);
		}

		public static double TyDfCLR_RectToCircle_HuiFeng(double dA0, double dA1, double dAngle)
		{
			double[,] array = new double[,]
			{
				{
					0.3,
					0.54,
					0.53,
					0.65,
					0.77,
					0.88,
					0.95,
					0.98,
					0.98,
					0.93
				},
				{
					0.3,
					0.5,
					0.53,
					0.64,
					0.75,
					0.84,
					0.89,
					0.91,
					0.91,
					0.88
				},
				{
					0.25,
					0.36,
					0.45,
					0.52,
					0.58,
					0.62,
					0.64,
					0.64,
					0.64,
					0.64
				},
				{
					0.15,
					0.21,
					0.25,
					0.3,
					0.33,
					0.33,
					0.33,
					0.32,
					0.31,
					0.3
				},
				{
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0
				},
				{
					0.24,
					0.28,
					0.26,
					0.2,
					0.22,
					0.24,
					0.49,
					0.73,
					0.97,
					1.04
				},
				{
					0.89,
					0.78,
					0.79,
					0.7,
					0.88,
					1.12,
					2.72,
					4.33,
					5.62,
					6.58
				},
				{
					1.89,
					1.67,
					1.59,
					1.49,
					1.98,
					2.52,
					6.51,
					10.14,
					13.05,
					15.14
				},
				{
					5.09,
					5.32,
					5.15,
					5.05,
					6.5,
					8.05,
					19.06,
					29.07,
					37.08,
					43.05
				}
			};
			double[] array2 = new double[]
			{
				0.06,
				0.1,
				0.25,
				0.5,
				1.0,
				2.0,
				4.0,
				6.0,
				10.0
			};
			double[] array3 = new double[]
			{
				10.0,
				15.0,
				20.0,
				30.0,
				45.0,
				60.0,
				90.0,
				120.0,
				150.0,
				180.0
			};
			double num = dA0 / dA1;
			int num2 = -1;
			int num3 = -1;
			for (int i = 0; i < 9; i++)
			{
				if (HYMathUtility.IsEqual(dAngle, array3[i], 0.01))
				{
					num2 = i;
					break;
				}
			}
			if (num < array2[0])
			{
				num = array2[0];
			}
			for (int i = 0; i < 10; i++)
			{
				if (num >= array2[i])
				{
					num3 = i;
				}
			}
			double num4;
			if (num3 == 8)
			{
				num4 = array[num3, num2];
			}
			else
			{
				num4 = (array[num3 + 1, num2] - array[num3, num2]) / (array2[num3 + 1] - array2[num3]) * (num - array2[num3]) + array[num3, num2];
			}
			if (num4 <= 0.0)
			{
				return 0.0;
			}
			return num4;
		}

		public static double DistributaryCLR_90Rectangle_B(double dQc, double dAc, double dQb, double dAb)
		{
			double num = dQc / dAc;
			double num2 = dQb / dAb;
			double num3 = num2 / num;
			double num4 = 0.0;
			if (3.0 < num3)
			{
				num4 = (double)((int)(0.5 + 25.629999999999995 * Math.Pow(num3, 0.2027))) / 100.0;
			}
			else if (2.0 < num3)
			{
				num4 = 0.32;
			}
			else if (1.0 < num2 / num)
			{
				num4 = (double)((int)(0.5 + 100.0 * (-0.8184 * Math.Pow(num3, 5.0) + 6.6951 * Math.Pow(num3, 4.0) - 21.957 * Math.Pow(num3, 3.0) + 36.411 * Math.Pow(num3, 2.0) - 30.982 * Math.Pow(num3, 1.0) + 11.381))) / 100.0;
			}
			else if (0.667 < num3)
			{
				num4 = (double)((int)(0.5 + 100.0 * (-68.925 * Math.Pow(num3, 5.0) + 298.65 * Math.Pow(num3, 4.0) - 525.84 * Math.Pow(num3, 3.0) + 474.42 * Math.Pow(num3, 2.0) - 222.78 * Math.Pow(num3, 1.0) + 45.208))) / 100.0;
			}
			else if (0.2 < num3)
			{
				num4 = (double)((int)(0.5 + 100.0 * (-1500.8 * Math.Pow(num3, 5.0) + 4180.2 * Math.Pow(num3, 4.0) - 4711.6 * Math.Pow(num3, 3.0) + 2716.0 * Math.Pow(num3, 2.0) - 817.18 * Math.Pow(num3, 1.0) + 107.29))) / 100.0;
			}
			else if (0.11 < num3)
			{
				num4 = (double)((int)(0.5 + 74.94 * Math.Pow(num3, -2.1224))) / 100.0;
			}
			if (num4 <= 0.0)
			{
				return 0.0;
			}
			return num4;
		}

		public static double DistributaryCLR_45Circle_B(double dQc, double dAc, double dQb, double dAb)
		{
			double num = dQc / dAc;
			double num2 = dQb / dAb / num;
			double num3;
			if (1.499 < num2)
			{
				num3 = 0.0446 * Math.Pow(num2, 4.0) - 0.4446 * Math.Pow(num2, 3.0) + 1.5573 * Math.Pow(num2, 2.0) - 2.1483 * num2 + 1.3017;
			}
			else if (1.199 < num2)
			{
				num3 = 0.3;
			}
			else if (0.999 < num2)
			{
				num3 = 0.8262 - 0.4509 * num2;
			}
			else if (0.669 < num2)
			{
				num3 = 0.3507 * Math.Pow(num2, -2.6071);
			}
			else if (0.429 < num2)
			{
				num3 = 0.3451 * Math.Pow(num2, -2.6943);
			}
			else if (0.219 < num2)
			{
				num3 = 0.4564 * Math.Pow(num2, -2.381);
			}
			else
			{
				num3 = 0.6312 * Math.Pow(num2, -2.1676);
			}
			if (num3 <= 0.0)
			{
				return 0.0;
			}
			return num3;
		}

		public static double TyDfCLR_CircleToRect_SongFeng(double dA0, double dA1, double dAngle)
		{
			double[,] array = new double[,]
			{
				{
					0.05,
					0.05,
					0.05,
					0.05,
					0.07,
					0.08,
					0.19,
					0.29,
					0.37,
					0.43
				},
				{
					0.05,
					0.05,
					0.05,
					0.04,
					0.06,
					0.07,
					0.18,
					0.28,
					0.36,
					0.42
				},
				{
					0.06,
					0.05,
					0.05,
					0.04,
					0.06,
					0.07,
					0.17,
					0.27,
					0.35,
					0.41
				},
				{
					0.06,
					0.07,
					0.07,
					0.05,
					0.06,
					0.06,
					0.12,
					0.18,
					0.24,
					0.26
				},
				{
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0
				},
				{
					0.6,
					0.84,
					1.0,
					1.2,
					1.32,
					1.32,
					1.32,
					1.28,
					1.24,
					1.2
				},
				{
					4.0,
					5.76,
					7.2,
					8.32,
					9.28,
					9.92,
					10.24,
					10.24,
					10.24,
					10.24
				},
				{
					30.0,
					50.0,
					53.0,
					64.0,
					75.0,
					84.0,
					89.0,
					91.0,
					91.0,
					88.0
				},
				{
					76.8,
					138.24,
					135.68,
					166.4,
					197.12,
					225.28,
					243.2,
					250.88,
					250.88,
					238.08
				}
			};
			double[] array2 = new double[]
			{
				0.1,
				0.17,
				0.25,
				0.5,
				1.0,
				2.0,
				4.0,
				10.0,
				16.0
			};
			double[] array3 = new double[]
			{
				10.0,
				15.0,
				20.0,
				30.0,
				45.0,
				60.0,
				90.0,
				120.0,
				150.0,
				180.0
			};
			double num = dA0 / dA1;
			int num2 = -1;
			int num3 = -1;
			for (int i = 0; i < 9; i++)
			{
				if (HYMathUtility.IsEqual(dAngle, array3[i], 0.01))
				{
					num2 = i;
					break;
				}
			}
			if (num < array2[0])
			{
				num = array2[0];
			}
			for (int i = 0; i < 10; i++)
			{
				if (num >= array2[i])
				{
					num3 = i;
				}
			}
			double num4;
			if (num3 == 8)
			{
				num4 = array[num3, num2];
			}
			else
			{
				num4 = (array[num3 + 1, num2] - array[num3, num2]) / (array2[num3 + 1] - array2[num3]) * (num - array2[num3]) + array[num3, num2];
			}
			if (num4 <= 0.0)
			{
				return 0.0;
			}
			return num4;
		}

		public static double TyDfCLR_CircleToRect_HuiFeng(double dA0, double dA1, double dAngle)
		{
			double[,] array = new double[,]
			{
				{
					0.3,
					0.54,
					0.53,
					0.65,
					0.77,
					0.88,
					0.95,
					0.98,
					0.98,
					0.93
				},
				{
					0.3,
					0.5,
					0.53,
					0.64,
					0.75,
					0.84,
					0.89,
					0.91,
					0.91,
					0.88
				},
				{
					0.25,
					0.36,
					0.45,
					0.52,
					0.58,
					0.62,
					0.64,
					0.64,
					0.64,
					0.64
				},
				{
					0.15,
					0.21,
					0.25,
					0.3,
					0.33,
					0.33,
					0.33,
					0.32,
					0.31,
					0.3
				},
				{
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0
				},
				{
					0.24,
					0.28,
					0.26,
					0.2,
					0.22,
					0.24,
					0.49,
					0.73,
					0.97,
					1.04
				},
				{
					0.89,
					0.78,
					0.79,
					0.7,
					0.88,
					1.12,
					2.72,
					4.33,
					5.62,
					6.58
				},
				{
					1.89,
					1.67,
					1.59,
					1.49,
					1.98,
					2.52,
					6.51,
					10.14,
					13.05,
					15.14
				},
				{
					5.09,
					5.32,
					5.15,
					5.05,
					6.5,
					8.05,
					19.06,
					29.07,
					37.08,
					43.05
				}
			};
			double[] array2 = new double[]
			{
				0.06,
				0.1,
				0.25,
				0.5,
				1.0,
				2.0,
				4.0,
				6.0,
				10.0
			};
			double[] array3 = new double[]
			{
				10.0,
				15.0,
				20.0,
				30.0,
				45.0,
				60.0,
				90.0,
				120.0,
				150.0,
				180.0
			};
			double num = dA0 / dA1;
			int num2 = -1;
			int num3 = -1;
			for (int i = 0; i < 9; i++)
			{
				if (HYMathUtility.IsEqual(dAngle, array3[i], 0.01))
				{
					num2 = i;
					break;
				}
			}
			if (num < array2[0])
			{
				num = array2[0];
			}
			for (int i = 0; i < 10; i++)
			{
				if (num >= array2[i])
				{
					num3 = i;
				}
			}
			double num4;
			if (num3 == 8)
			{
				num4 = array[num3, num2];
			}
			else
			{
				num4 = (array[num3 + 1, num2] - array[num3, num2]) / (array2[num3 + 1] - array2[num3]) * (num - array2[num3]) + array[num3, num2];
			}
			if (num4 <= 0.0)
			{
				return 0.0;
			}
			return num4;
		}

		public static double TyDfCLR_RectToCircle_SongFeng(double dA0, double dA1, double dAngle)
		{
			double[,] array = new double[,]
			{
				{
					0.05,
					0.05,
					0.05,
					0.05,
					0.07,
					0.08,
					0.19,
					0.29,
					0.37,
					0.43
				},
				{
					0.05,
					0.05,
					0.04,
					0.04,
					0.06,
					0.07,
					0.18,
					0.28,
					0.36,
					0.42
				},
				{
					0.06,
					0.05,
					0.05,
					0.04,
					0.06,
					0.07,
					0.17,
					0.27,
					0.35,
					0.41
				},
				{
					0.06,
					0.07,
					0.07,
					0.05,
					0.06,
					0.06,
					0.12,
					0.18,
					0.24,
					0.26
				},
				{
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0,
					0.0
				},
				{
					0.6,
					0.84,
					1.0,
					1.2,
					1.32,
					1.32,
					1.32,
					1.28,
					1.24,
					1.2
				},
				{
					4.0,
					5.76,
					7.2,
					8.32,
					9.28,
					9.92,
					10.24,
					10.24,
					10.24,
					10.24
				},
				{
					30.0,
					50.0,
					53.0,
					64.0,
					75.0,
					84.0,
					89.0,
					91.0,
					91.0,
					88.0
				},
				{
					76.8,
					138.24,
					135.68,
					166.4,
					197.12,
					225.28,
					243.2,
					250.88,
					250.88,
					238.08
				}
			};
			double[] array2 = new double[]
			{
				0.1,
				0.17,
				0.25,
				0.5,
				1.0,
				2.0,
				4.0,
				10.0,
				16.0
			};
			double[] array3 = new double[]
			{
				10.0,
				15.0,
				20.0,
				30.0,
				45.0,
				60.0,
				90.0,
				120.0,
				150.0,
				180.0
			};
			double num = dA0 / dA1;
			int num2 = -1;
			int num3 = -1;
			for (int i = 0; i < 9; i++)
			{
				if (HYMathUtility.IsEqual(dAngle, array3[i], 0.01))
				{
					num2 = i;
					break;
				}
			}
			if (num < array2[0])
			{
				num = array2[0];
			}
			for (int i = 0; i < 10; i++)
			{
				if (num >= array2[i])
				{
					num3 = i;
				}
			}
			double num4;
			if (num3 == 8)
			{
				num4 = array[num3, num2];
			}
			else
			{
				num4 = (array[num3 + 1, num2] - array[num3, num2]) / (array2[num3 + 1] - array2[num3]) * (num - array2[num3]) + array[num3, num2];
			}
			if (num4 <= 0.0)
			{
				return 0.0;
			}
			return num4;
		}

		public const double B_const = 101325.0;

		private static double[] BaoHeYaLi = new double[]
		{
			12.85,
			14.38,
			16.08,
			17.96,
			20.05,
			22.35,
			24.9,
			27.72,
			30.82,
			34.25,
			38.82,
			42.17,
			46.73,
			51.75,
			57.25,
			63.29,
			69.91,
			77.16,
			85.1,
			93.78,
			103.26,
			113.62,
			124.92,
			137.25,
			150.68,
			165.3,
			181.22,
			198.52,
			217.32,
			237.75,
			259.91,
			283.95,
			309.99,
			338.21,
			368.74,
			401.78,
			437.48,
			476.06,
			517.73,
			562.68,
			611.17,
			657.1,
			706.0,
			758.1,
			813.5,
			872.5,
			935.3,
			1002.0,
			1072.9,
			1148.1,
			1228.0,
			1312.8,
			1402.6,
			1497.9,
			1598.7,
			1705.5,
			1818.5,
			1938.0,
			2164.3,
			2197.9,
			2338.9,
			2487.8,
			2644.8,
			2810.5,
			2985.2,
			3169.3,
			3363.3,
			3567.4,
			3782.3,
			4008.4,
			4246.2,
			4496.1,
			4758.6,
			5034.5,
			5324.2,
			5628.0,
			5964.8,
			6281.2,
			6631.5,
			6998.8,
			7383.8,
			7786.6,
			8208.1,
			8649.5,
			9111.0,
			9593.5,
			10098.2,
			10625.0,
			11175.4,
			11750.2,
			12350.3,
			12976.4,
			13629.3,
			14310.8,
			15020.5,
			15760.1,
			16531.1,
			17333.7,
			18169.1,
			19039.3,
			19934.9
		};

		private const double e_const = 2.71828;

		private const double g_const = 9.81;

		private static readonly int[] aryTforK1 = new int[]
		{
			5,
			10,
			20,
			30,
			40,
			50,
			55,
			60,
			65
		};

		private static readonly double[] aryK1 = new double[]
		{
			1.037,
			1.0,
			0.943,
			0.895,
			0.856,
			0.822,
			0.808,
			0.793,
			0.781
		};

		private static readonly double[] aryK2 = new double[]
		{
			0.573,
			0.733,
			1.0,
			1.553
		};

		private const double dCold = 0.0112;

		private const double dHot = 0.0089;

		public static double[,] SyphonXZ = new double[,]
		{
			{
				0.0,
				0.0
			},
			{
				20.0,
				0.31
			},
			{
				30.0,
				0.45
			},
			{
				45.0,
				0.6
			},
			{
				60.0,
				0.78
			},
			{
				75.0,
				0.9
			},
			{
				90.0,
				1.0
			},
			{
				110.0,
				1.13
			},
			{
				130.0,
				1.2
			},
			{
				150.0,
				1.28
			},
			{
				180.0,
				1.4
			}
		};

		public static double[,] SyphonLocalIndex = new double[,]
		{
			{
				0.5,
				0.75
			},
			{
				0.75,
				0.33
			},
			{
				1.0,
				0.22
			},
			{
				1.5,
				0.15
			},
			{
				2.0,
				0.13
			},
			{
				2.5,
				0.12
			}
		};

		public static double[,,] SyphonXZRe = new double[,,]
		{
			{
				{
					0.5,
					1.0,
					1.4
				},
				{
					0.5,
					2.0,
					1.26
				},
				{
					0.5,
					3.0,
					1.19
				},
				{
					0.5,
					4.0,
					1.4
				},
				{
					0.5,
					6.0,
					1.09
				},
				{
					0.5,
					8.0,
					1.06
				},
				{
					0.5,
					10.0,
					1.04
				},
				{
					0.5,
					14.0,
					1.0
				},
				{
					0.5,
					20.0,
					1.0
				}
			},
			{
				{
					0.75,
					1.0,
					2.0
				},
				{
					0.75,
					2.0,
					1.77
				},
				{
					0.75,
					3.0,
					1.64
				},
				{
					0.75,
					4.0,
					1.56
				},
				{
					0.75,
					6.0,
					1.46
				},
				{
					0.75,
					8.0,
					1.38
				},
				{
					0.75,
					10.0,
					1.3
				},
				{
					0.75,
					14.0,
					1.15
				},
				{
					0.75,
					20.0,
					1.0
				}
			}
		};
	}
}
